#include "const.h"

int isfile(const char *path) {
	struct stat s;

	if (stat(path, &s) != 0)
		return 0;

	if (~s.st_mode & S_IFREG) {
		errno = s.st_mode & S_IFDIR ? EISDIR : EBADF;
		return 0;
	}

	return 1;
}
